﻿using MengLin.OOP.DesignPattern.State.TrafficLights.Abstract;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MengLin.OOP.DesignPattern.State.TrafficLights.Implements
{
    /// <summary>
    /// 黄灯
    /// </summary>
    public class YellowLight : AbstractLight
    {
        /// <summary>
        /// 构造函数指定灯的颜色
        /// </summary>
        public YellowLight()
        {
            base.Color = LightColor.Yellow;
        }

        /// <summary>
        /// 显示
        /// </summary>
        public override void Show()
        {
            Console.WriteLine("黄灯等一等");
        }

        /// <summary>
        /// 灯的颜色改变（传统写法）
        /// </summary>
        public override void Turn()
        {
            base.Color = LightColor.Red;
        }

        /// <summary>
        /// 变灯
        /// </summary>
        public override void Change(Context context)
        {
            context.CurrentLight = new RedLight();
        }
    }
}
